#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;


string countandsay(string str)
{
    string ans;
    if (str.size() == 0) return ans;

    for (int i = 0; i < str.size(); ) {
	char cur = str[i];
        int cnt = 1;
        while(++i < str.size() && str[i] == cur) cnt++;
        ans += cnt+'0';
        ans += cur;
    }
    return ans;
}

int main(int argc, char **argv)
{
    cout << countandsay("111222233333") << endl;
    cout << countandsay("123") << endl;
    cout << countandsay("11111111") << endl;
    cout << "-----------------Test 1--------------------" << endl;


    cout << "-----------------Test 2--------------------" << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
